package com.sixth.config;
import com.sixth.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@CrossOrigin
@RestController
@RequestMapping("/home/banner")
public class OssController {

    @Autowired
    private OssService ossService;
    //上传头像，返回图片的url给
    @PostMapping("/uploadMsg")
    public String uploadOssFile(MultipartFile file){
        //获取上传文件 MultipartFile
        //返回图片在oss上的路径
        String url = ossService.uploadFileAvatar(file);
//        return new CommonResult()
        System.out.println(url+"查看是否拿到");
        return  url;
    }
}